package com.qinhong.controller;

import com.qinhong.anno.MyAnnotationSwagger;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RestController
@RequestMapping("/swagger")
// 描述当前类型生成帮助文档的信息
@Api(tags = {"MyController","Swagger学习控制器"},description = "测试api类型描述信息")
public class MyController {

    @PostMapping("/post")
    @ApiOperation(value = "post方法，数据新增操作",notes = "Swagger处理post请求的方法")
    public String post(){
        return "post";
    }

    @ApiIgnore //忽略 当前注解描述的方法和类型
    @GetMapping("/get")
    public String get(@ApiParam(name = "用户名",value = "新增用户时提供用户名",required = true) String a, String b){
        return "get";
    }

    @MyAnnotationSwagger()
    @RequestMapping("/req")
    public String req(String m){
        return "req";
    }

    @GetMapping("/test")
    @ApiImplicitParam(name = "m",value = "m参数描述",required = false,paramType = "字符串" ,dataType="")
    public String test(String m,String n){
        return "test";
    }
}
